package com.hansming.bss.modules.sfc.util;

import java.util.ArrayList;
import java.util.Date;

/*
 * 发送短信的帮助类
 */
import com.hansming.bss.common.utils.PropertiesLoader;

public class PhoneMsgUtil {
	static PropertiesLoader config = new PropertiesLoader("config.properties");
	static int appid = config.getInteger("phonemsgappid");
	static String appkey = config.getProperty("phonemsgappkey");
	
	
	//编号73642（内容：尊敬的用户，你的订单{1}已支付，正在确认中，我们会在24小时内联系您，请您留意您的电话及短信
	public static boolean sendSingleSms(String phone,String msg) throws Exception{
		boolean result1 = true;
		SmsSingleSender msgSender = new SmsSingleSender(appid, appkey);
		String nationCode = "86";
		ArrayList<String> params = new ArrayList();
		int templId = 73642;
		params.add(msg);
		String sign = "搜房车";
		String extend = "";
		String ext = "";
		SmsSingleSenderResult result = msgSender.sendWithParam(nationCode, phone, templId, params, sign, extend, ext);
		if(result.result == 0){
			result1 = true;
		}else{
			result1 = false;
		}
		return result1;
	}
	
	//编号81382（内容：尊敬的用户，恭喜您，订单{1}预定成功，可登录搜房车小程序“我的”查询订单，祝您旅途愉快。
		public static boolean sendSingleSms1(String phone,String msg) throws Exception{
			boolean result1 = true;
			SmsSingleSender msgSender = new SmsSingleSender(appid, appkey);
			String nationCode = "86";
			ArrayList<String> params = new ArrayList();
			int templId = 81382;
			params.add(msg);
			String sign = "搜房车";
			String extend = "";
			String ext = "";
			SmsSingleSenderResult result = msgSender.sendWithParam(nationCode, phone, templId, params, sign, extend, ext);
			if(result.result == 0){
				result1 = true;
			}else{
				result1 = false;
			}
			return result1;
		}
		
		//编号68501（内容：尊敬的用户，订单{1}预定失败，我们将于7个工作日内给您退款，造成不便敬请谅解。
				public static boolean sendSingleSms3(String phone,String msg) throws Exception{
					boolean result1 = true;
					SmsSingleSender msgSender = new SmsSingleSender(appid, appkey);
					String nationCode = "86";
					ArrayList<String> params = new ArrayList();
					int templId = 68501;
					params.add(msg);
					String sign = "搜房车";
					String extend = "";
					String ext = "";
					SmsSingleSenderResult result = msgSender.sendWithParam(nationCode, phone, templId, params, sign, extend, ext);
					if(result.result == 0){
						result1 = true;
					}else{
						result1 = false;
					}
					return result1;
				}
				
				//编号68502（内容：尊敬的用户，您的订单{1}已取消，如果继续下单请登陆www.sofangch.com
				public static boolean sendSingleSms4(String phone,String msg) throws Exception{
					boolean result1 = true;
					SmsSingleSender msgSender = new SmsSingleSender(appid, appkey);
					String nationCode = "86";
					ArrayList<String> params = new ArrayList();
					int templId = 68502;
					params.add(msg);
					String sign = "搜房车";
					String extend = "";
					String ext = "";
					SmsSingleSenderResult result = msgSender.sendWithParam(nationCode, phone, templId, params, sign, extend, ext);
					if(result.result == 0){
						result1 = true;
					}else{
						result1 = false;
					}
					return result1;
				}
}
